/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Views;



import Views.GestionClient.ClientCreationFrame;
import Views.GestionMenu.GestionMenuFrame;
import Views.GestionMenu.SelectRestaurantFrame;
import Views.GestionRestaurant.RestaurantFrame;
import Views.GestionRestaurateur.RestaurateurFrame;
import Views.PasserCommande.PasserCommandeFrame;
import Views.PreparerCommande.PreparerCommandeFrame;
import Views.PreparerCommande.SelectRestaurantCmdFrame;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 *
 * @author ibrahim
 */
public class MainPanel extends JPanel {
    
    
    private JButton gererRestaurants, gererRestaurateurs, creerClient, passerCommande, gererMenu, preparerCommande;
    private RestaurateurFrame myRestauranteurFrame; 
    private RestaurantFrame myRestaurantFrame; 
    private SelectRestaurantFrame mySelectRestaurantFrame;
    private ClientCreationFrame myClientCreationFrame;
    private PasserCommandeFrame myPasserCommandeFrame;
    private SelectRestaurantCmdFrame mySelectRestaurantCmdFrame;
    public MainPanel() {
   
    Dimension dim =getPreferredSize();
    dim.width=250;
    setPreferredSize(dim);
    this.gererRestaurants = new JButton("Gerer Restaurants");
    this.gererRestaurateurs = new JButton("Gerer Restaurateurs");
    this.creerClient = new JButton("Creer Client");
    this.passerCommande = new JButton("Passer une Commande");
    this.gererMenu = new JButton("Gérer les menus");
    this.preparerCommande = new JButton("Préparer les commandes");
    setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
        
    //1ST LINE
    gc.gridy=0;
    gc.weightx=1;
    gc.weighty=0.1;
    gc.gridx=0;
    gc.fill = GridBagConstraints.NONE;
    add(gererRestaurants,gc);
    
    gc.gridy++;
    add(gererRestaurateurs,gc);
    
    gc.gridy++;
    add(creerClient,gc);
    
    gc.gridy++;
    add(passerCommande,gc);
    
    gc.gridy++;
    add(gererMenu,gc);
    
    gc.gridy++;
    add(preparerCommande,gc);
    
    this.creerClient.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
             new ClientCreationFrame();
        }
    });
    
    this.gererRestaurateurs.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
           myRestauranteurFrame = new RestaurateurFrame();
           myRestauranteurFrame.commencerAjoutNewRestaurateur();
           
        }
    });
    
    this.gererRestaurants.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            myRestaurantFrame = new RestaurantFrame();
            myRestaurantFrame.commencerAjoutNewRestaurant();
        }
    });
    
    this.passerCommande.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            myPasserCommandeFrame = new PasserCommandeFrame();
        }
    });
    
    this.gererMenu.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mySelectRestaurantFrame = new SelectRestaurantFrame();
        }
    });
    
    this.preparerCommande.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mySelectRestaurantCmdFrame = new SelectRestaurantCmdFrame();
        }
    });
    
    }
    
    
   
}
